<template>
  <div class="ding-ding-container" :class="[`${prefixCls}`]">
    <div class="ding-header">
      <ul class="ding-menu-tab">
        <li :class="activeKey === 'daiban' ? 'active' : ''" @click="dingLiClick('daiban')"><a>待办任务</a></li>
        <li :class="activeKey === 'yiban' ? 'active' : ''" @click="dingLiClick('yiban')"><a>已办任务</a></li>
        <li :class="activeKey === 'shenqing' ? 'active' : ''" @click="dingLiClick('shenqing')"><a>我发起的</a></li>
      </ul>
    </div>
    <div v-show="activeKey === 'daiban'" class="base-collapse">
      <backlogfrom />
    </div>
    <div v-show="activeKey === 'shenqing'" class="base-collapse">
      <applyfrom />
    </div>
    <div v-show="activeKey === 'yiban'" class="base-collapse">
      <donefrom />
    </div>
    <div v-show="activeKey === 'caogao'" class="base-collapse">
      <draftfrom />
    </div>
  </div>
</template>

<script lang="ts">
  import { defineComponent, ref } from 'vue';
  import draftfrom from './components/draft/index.vue';
  import donefrom from './components/done/index.vue';
  import applyfrom from './components/apply/index.vue';
  import backlogfrom from './components/backlog/index.vue';
  import { useDesign } from '/@/hooks/web/useDesign';

  export default defineComponent({
    name: 'multipleTabs',
    components: {
      // TodoComponent,
      draftfrom,
      donefrom,
      applyfrom,
      backlogfrom,
    },
    setup() {
      const { prefixCls } = useDesign('j-dd-container');

      //选中的key
      const activeKey = ref<string>('daiban');

      /**
       * tab点击事件
       * @param key
       */
      function dingLiClick(key) {
        activeKey.value = key;
      }

      return {
        activeKey,
        dingLiClick,
        prefixCls,
      };
    },
  });
</script>

<style lang="less" scoped>
  .ding-ding-container {
    border-radius: 8px;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .base-collapse {
    flex: 1;
    overflow: hidden;
  }
  .ding-header {
    align-items: center;
    /*begin 兼容暗夜模式*/
    border-bottom: 1px solid @border-color-base;
    /*end 兼容暗夜模式*/
    box-sizing: border-box;
    display: flex;
    height: 50px;
    justify-content: space-between;
    padding: 0 24px;

    ul {
      margin-bottom: 0;
    }
  }
  .ding-menu-tab {
    display: flex;
    height: 100%;

    li {
      align-items: center;
      border-bottom: 2px solid transparent;
      display: flex;
      height: 100%;
      margin-right: 38px;

      a {
        /*begin 兼容暗夜模式*/
        color: @text-color !important;
        /*end 兼容暗夜模式*/
        font-size: 15px;
        font-weight: 700;
      }
    }
  }
  .active {
    border-bottom-color: @primary-color !important;

    a {
      color: #333 !important;
    }
  }
  .empty-image {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: calc(100% - 50px);
    justify-content: center;
    width: 100%;
  }
</style>

<style lang="less">
  /* update-begin-author:liusq date:20230625 for: [issues/563]暗色主题部分失效*/
  @prefix-cls: ~'@{namespace}-j-dd-container';
  /*begin 兼容暗夜模式*/
  .@{prefix-cls} {
    background: @component-background;

    .ding-header {
      border-bottom: 1px solid @border-color-base;
    }

    .ding-menu-tab {
      li {
        a {
          color: @text-color !important;
        }
      }
    }

    .ant-collapse-borderless {
      background-color: @component-background;
    }

    .ant-collapse {
      background-color: @component-background;
    }
  }
  .cyj-full-screen-modal-code-generate.process-common-modal {
    .ant-modal-body {
      overflow: hidden;
    }
    @approval-components-width: 400px;
    .approval-form-page {
      display: flex;
      justify-content: space-between;
      min-height: calc(100vh - 60px - 50px);
      height: calc(100vh - 50px);
    }

    .approval-form {
      width: calc(100% - @approval-components-width - 16px);
      background-color: #fff;
      padding: 16px;
      flex: 1;
      overflow: auto;
    }

    .approval-components {
      width: @approval-components-width;
      background-color: #fff;
      height: 100%;
      display: flex;
      flex-direction: column;
      .record-preview-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        .approve-progress {
          flex: 1;
          display: flex;
          flex-direction: column;
          overflow: hidden;
          .bla-record-preview {
            flex: 1;
            overflow: auto;
          }
        }
      }
    }
    .decison {
      position: relative;
      padding: 12px;
      border-radius: 8px;
    }

    .approval-form-page .cyj-j-vxe-table .ant-spin-container {
      display: block;
    }

    .approval-form-page .discuss {
      padding: 12px 0 0 0;
    }
  }
  /*end 兼容暗夜模式*/
  /* update-end-author:liusq date:20230625 for: [issues/563]暗色主题部分失效*/
</style>
